<template>
  <tr class="tr">
    <th width="15%">
      全选
      <input type="checkbox" v-model="checkAll" />
    </th>
    <th width="35%">商品</th>
    <th width="10%">单价</th>
    <th width="10%">数量</th>
    <th width="15%">小计</th>
    <th width="15%">操作</th>
  </tr>
</template>

<script setup>
import mitts from "@/bus";
const productList = ref([]);
mitts.on("giveProductList", (e) => {
  productList.value = e;
});
const checkAll = computed({
  get() {
    const res = productList.value.every((item) => {
      return item.isSelected;
    });
    return res;
  },
  set(newval) {
    mitts.emit('changeProductList-select',newval)
  }
});
</script>

<style lang="scss" scoped>
.tr {
  height: 40px;
  font-size: 14px;
  font-weight: 600;
  th {
    border: 1px solid hsl(204, 13%, 92%);
    padding-left: 7px;
  }
}
</style>
